
.PHONY:all test pub clean dist_clean

SERVER:=192.168.133.128
SERVER:=192.168.139.129
SERVER:=192.168.1.114
SERVER:=192.168.139.130
SERVER:=192.168.1.232
SERVER:=192.168.1.200
SERVER:=192.168.232.129

t:all
	/usr/bin/scp web.tgz $(SERVER):/packages
	/usr/bin/scp web.tgz $(SERVER):/ldisk/upgrade/
	/usr/bin/ssh $(SERVER) /bin/tar xzf /packages/web.tgz

test:
	rm -rf usr web.tgz
	find . -type f -amin -2 -exec cp -rf {} /usr/local/apache2/htdocs/ \;
	find config.xml -type f -amin -2 -exec cp -rf {} ../encode_html/ \;
	#find . -path ./.svn -prune -o -print -type f -amin -5 #

all:pub
	cp -rf *.xml usr/local/apache2/htdocs/ ../encode_html/
	/bin/tar czf web.tgz usr

pub:
	rm -rf  usr
	mkdir -p usr/local/apache2/htdocs/ && mkdir -p usr/local/php/lib/php
	mkdir -p usr/local/apache2/htdocs/user/
	cp -rf ../encode_html/css ../encode_html/js ../encode_html/images usr/local/apache2/htdocs/ 
	rm -rf  usr/local/apache2/htdocs/js/.svn \
		usr/local/apache2/htdocs/css/.svn \
		usr/local/apache2/htdocs/images/.svn
	cp -rf ../encode_html/*.htm usr/local/apache2/htdocs/
	cp -rf *.php usr/local/apache2/htdocs/ 
	cd usr/local/apache2/htdocs && for i in *.php; do encode $$i ; done
	for i in `ls function*`; do ln -s /usr/local/apache2/htdocs/$$i usr/local/php/lib/php/$$i ;done

clean:
	rm -rf web.tgz usr *.txt
dist_clean:clean
	rm -rf tags
